<template>
    <a-form-item :label="label">
        <a-input size="small" v-model:value="InputValue">
            <template #suffix>
                {{ unit }}
            </template>
        </a-input>
    </a-form-item>
</template>
<script setup>
import { ref, watch } from 'vue';

const emit = defineEmits(['update:modelValue'])
const props = defineProps({
    // 名称
    label: String,
    // 单位
    unit: String,
    // 表单数据
    modelValue: String,
});

const InputValue = ref();

watch(() => props.modelValue, val => {
    InputValue.value = val;
}, { immediate: true });

watch(InputValue, (val) => {
    emit('update:modelValue', val);
})

</script>
<style lang="less" scoped>

</style>